﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WcfServiceLibraryDao
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
    public class ServiceDao : IServiceDaoAdd
    {
        public void InsertClass(string name)
        {
            SchoolDataContext context = new SchoolDataContext();
            Class newClass = new Class()             
            {
                ClassName = name
            };
            context.Classes.InsertOnSubmit(newClass);
            context.SubmitChanges();
        }

        public void InsertStudent(string name, int classId)
        {
            SchoolDataContext context = new SchoolDataContext();
            Student newStudent = new Student() 
            {
                Name = name,
                ClassID = classId                
            };
        }
    }
}
